#include "inc/zg291paradata.h"
#include <QByteArray>
#include <QByteArrayData>
bool TEMP_enabled = true;
bool HUM_enabled = true;
bool PM1_0_enabled = true;
bool PM2_5_enabled = true;
bool PM10_enabled = true;
bool TVOC_enabled = true;
bool BORD_enabled = true;
bool CH2O_enabled = true;
bool CO2_enabled = true;
bool PECU_enabled = true;
quint16 calculateCRC(const QByteArray &data)
{
    quint16 crc = 0xFFFF;

    for(int i = 0; i < data.size(); ++i) {
        crc ^= (quint8)data.at(i);

        for(int j = 0; j < 8; ++j) {
            if(crc & 0x0001) {
                crc >>= 1;
                crc ^= 0xA001;
            } else {
                crc >>= 1;
            }
        }
    }

    return crc;
}
